<html>
<head>
<script type="text/javascript">
function rpc(method, data, onready) {
	url = "http://127.0.0.1:8888/json";
	
	url+="?method="+method+"&data="+JSON.stringify(data);
	
	var http_request = new XMLHttpRequest();
	http_request.open("GET", url, true);
	http_request.onreadystatechange = function () {
		var done = 4, ok = 200;
		if (http_request.readyState == done &&
				http_request.status == ok) {
			result = JSON.parse(http_request.responseText);
			onready(result);
		}
	};
	http_request.send(null);
}

function onreadyRegister(result) {
	alert(result.userid);
}

function start() {
	rpc("register", {"username": "Heiko"}, onreadyRegister);
	//rpc("showAllPartiess", {}, onreadyShowAllParties);
}
</script>
</head>
<body onload="start()">
<h1>MÄDN</h1>
</body>
</html>